/**
 * @author Daivd chow
 *
 * 下午05:00:37
 */
package com.cbts.util;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.comet4j.core.CometContext;
import org.comet4j.core.CometEngine;
import org.springframework.beans.factory.InitializingBean;

import com.cbts.dao.UserInfoDao;

public class CometDemo implements ServletContextListener{

/*	private UserInfoDao userInfoDao;
	
	public UserInfoDao getUserInfoDao() {
		return userInfoDao;
	}
	public void setUserInfoDao(UserInfoDao userInfoDao) {
		this.userInfoDao = userInfoDao;
	}*/
	
	/* 
	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent sce) {
		// zqd 下午05:00:37
		CometContext cc=CometContext.getInstance();
		cc.registChannel(Constant.CHANNEL);
		Thread module=new Thread(new MessageThread(),"Message Thread");
		module.setDaemon(true);
		System.out.println("----start module----");
		module.start();
	}

	/* 
	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
	 */
	public void afterPropertiesSet() throws Exception {
		// zqd 上午09:40:09
		//
		System.out.println("start");
	}

	/* 
	 * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
	 */
	public void contextDestroyed(ServletContextEvent sce) {
		// zqd 上午10:20:19
		
	}

}
